import 'package:freedom/page/mahjong/common/mahjong_context.dart';
import 'package:freedom/page/mahjong/common/message_content.dart';
import 'package:freedom/page/mahjong/event/user_reflash_action.dart';
import 'package:freedom/page/mahjong/message/abstract_action_message.dart';
import 'package:freedom/page/mahjong/message/action_message.dart';

class RefreshAction extends AbstractMessageActionHandler<MahjongMessage> {
  @override
  void doMessage(MahjongMessage message) {
    var sourceUserId = message.exeActionUid;
    MahjongContext.postUserEvent<UserReflashActionEvent>(
        sourceUserId, UserReflashActionEvent(message.actionSet!));
    bool hasBar =
        message.actionSet?.contains(ActionMessageHandler.BAR) ?? false;
    if (!hasBar) {
      MahjongContext().closeOverlay(MahjongOverlay.multipmleChoiceCardDialog);
    }
  }
}
